const files = import.meta.glob('./**/index.js', { eager: true })

export default {
  // options为各个组件默认配置
  install: (app, options = {}) => {
    for (const key in files) {
      if (Object.prototype.hasOwnProperty.call(files, key)) {
        const comInstall = files[key]['default'];
        const comName = files[key]['default']['name'];
        const comOption = options[comName] || {}
        app.use(comInstall, comOption)
      }
    }
  }
}